package com.zth.service.impl;

import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageHelper;
import com.zth.mapper.BlogMapper;
import com.zth.mapper.TagMapper;
import com.zth.pojo.Blog;
import com.zth.pojo.Tag;
import com.zth.service.BlogServace;

@Service
@Transactional
public class BlogServaceImpl implements BlogServace{
	@Autowired
	private BlogMapper blogMapper;
	@Autowired
	private TagMapper tagMapper;
	
	@Override
	public List<Blog> blogAll( int page, int pageSize,Blog blog) {
		PageHelper.startPage(page,pageSize);
		PageHelper.orderBy("blog_id desc");
		return blogMapper.blogAll(blog);
	}

	@Override
	public int deleteBatch(int[] ids) {
		
		return blogMapper.deleteBatch(ids);
	}

	@Override
	public Blog blogById(int id) {
		// TODO Auto-generated method stub
		return blogMapper.blogById(id);
	}

	@Override
	public int edit(Blog blog) {
		// TODO Auto-generated method stub
		return blogMapper.edit(blog);
	}

	@Override
	public int add(Blog blog) {
		
		return blogMapper.add(blog);
	}

	@Override
	public List<String> getTag(int[] blog_tags) {
		return blogMapper.getTag(blog_tags);
	}

	@Override
	public int editViews(Blog blog) {
		return blogMapper.editViews(blog);
	}



}
